package com.study.common;

import java.io.*;

public class Cheng {


    public static void main(String[] args) {

        StringBuilder stringBuilder = new StringBuilder();

        for (int i = 1; i < 10; i++) {
            for (int j = 1; j <= i; j++) {
                stringBuilder.append(i).append("*").append(j).append("=").append(i * j).append(" ");
            }
            stringBuilder.append("\n");
        }

        byte[] bytes = stringBuilder.toString().getBytes();
        FileOutputStream fileOutputStream =null;
        try {

             fileOutputStream = new FileOutputStream("D:\\99.txt");

            fileOutputStream.write(bytes);

        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            if (fileOutputStream!=null){
                try {
                    fileOutputStream.flush();
                    fileOutputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }


    }
}
